package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestParam;

import java.beans.PropertyEditorSupport;
import java.util.Date;

// InitBinderTestController中添加了@InitBinder，InitBinderTest2Controller中则没有，
// 我想知道在Controller类中通过@InitBinder注册的PropertyEditor只影响当前类中的请求还是会影响所有Controller的请求
// 结论：只影响当前的Controller而不影响其它的Controller
@Controller
public class InitBinderTest2Controller {

    @GetMapping("/test-init-binder2")
    public String testInitBinder(@RequestParam Date date) {
        System.out.println("date = " + date);
        return "index";
    }
}
